
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2282. -- [Sdoi2011]消防 -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2282: [Sdoi2011]消防</h2><span class=green>Time Limit: </span>10 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>512 MB<br><span class=green>Submit: </span>72&nbsp;&nbsp;<span class=green>Solved: </span>39<br>[<a href='submitpage.php?id=2282'>Submit</a>][<a href='problemstatus.php?id=2282'>Status</a>][<a href='bbs.php?id=2282'>Discuss</a>]</center><h2>Description</h2><div class=content><p class="MsoNormal" align="center" style="margin: 0cm 0cm 0pt; text-align: center"></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">某个国家有</span><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;">n</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个城市，这</span><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;">n</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个城市中任意两个都连通且有唯一一条路径，每条连通两个城市的道路的长度为</span><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;">zi(zi&lt;=1000)</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</span><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个国家的人对火焰有超越宇宙的热情，所以这个国家最兴旺的行业是消防业。由于政府对国民的热情忍无可忍（大量的消防经费开销）可是却又无可奈何（总统竞选的国民支持率），所以只能想尽方法提高消防能力。</span><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">现在这个国家的经费足以在一条边长度和不超过</span><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;">s</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的路径（两端都是城市）上建立消防枢纽，为了尽量提高枢纽的利用率，要求其他所有城市到这条路径的距离的最大值最小。</span><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">你受命监管这个项目，你当然需要知道应该把枢纽建立在什么位置上。</span><span lang="EN-US" style="font-size: 12pt; font-family: &quot;Times New Roman&quot;"><o:p></o:p></span></p>
<p></p></div><h2>Input</h2><div class=content><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">输入包含</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">n</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">行：</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt"><br />
<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">第</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">1</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">行，两个正整数</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">n</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">和</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">s</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">，中间用一个空格隔开。其中</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">n</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">为城市的个数，</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">s</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">为路径长度的上界。设结点编号以此为</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">1</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">，</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">2</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">，</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">&hellip;&hellip;</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">，</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">n</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">。</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt"><br />
&nbsp;&nbsp;</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">从第</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">2</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">行到第</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">n</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">行，每行给出</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">3</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">个用空格隔开的正整数，依次表示每一条边的两个端点编号和长度。例如，</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">&ldquo;2 4 7&rdquo;</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">表示连接结点</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">2</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">与</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">4</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">的边的长度为</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'; mso-font-kerning: 0pt">7</span><span style="font-size: 12pt; font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">。</span><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p>
<p class="HTMLPreformatted" style="margin: 0cm 0cm 0pt"><span lang="EN-US" style="font-family: 'Times New Roman'"><o:p><font size="3">&nbsp;</font></o:p></span></p>
<p class="HTMLPreformatted" style="margin: 0cm 0cm 0pt; text-indent: 24pt; mso-char-indent-count: 2.0"><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p></div><h2>Output</h2><div class=content><p class="HTMLPreformatted" style="margin: 0cm 0cm 0pt; text-indent: 24pt; mso-char-indent-count: 2.0"><font size="3"><font face="宋体"><span style="mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">输出包含一个非负整数，即所有城市到选择的路径的最大值，当然这个最大值必须是所有方案中最小的。</span><span lang="EN-US" style="font-family: 'Times New Roman'"><o:p></o:p></span></font></font></p>
<p class="HTMLPreformatted" style="margin: 0cm 0cm 0pt; text-indent: 24pt; mso-char-indent-count: 2.0"><span lang="EN-US" style="font-size: 12pt; font-family: 'Times New Roman'"><o:p></o:p></span></p></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata> <br />
<br />
【样例输入1】<br />
<br />
5 2<br />
1 2 5<br />
2 3 2<br />
2 4 4<br />
2 5 3 <br />
<br />
【样例输出1】<br />
<br />
5<br />
<br />
【样例输入2】<br />
<br />
8 6<br />
1 3 2<br />
2 3 2 <br />
3 4 6<br />
4 5 3<br />
4 6 4<br />
4 7 2<br />
7 8 3  <br />
<br />
【样例输出2】<br />
<br />
5<br />
<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata></span></div><h2>HINT</h2>
			<div class=content><p><p>【数据规模和约定】</p><br />
<p>对于20%的数据，n&lt;=300。</p><br />
<p>对于50%的数据，n&lt;=3000。</p><br />
<p>对于100%的数据，n&lt;=300000，边长小等于1000。 <br /><br />
</p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=stage 2 day1'>stage 2 day1</a></p></div><center>[<a href='submitpage.php?id=2282'>Submit</a>][<a href='problemstatus.php?id=2282'>Status</a>][<a href='bbs.php?id=2282'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
